set(BASEDMN_SOURCES base_daemon.cc)

add_subdirectory(s7daemon)

add_executable(aqtdmn
  aqtdmn.cc
)

target_link_libraries(aqtdmn
  PRIVATE
    Szarp2
)

add_executable(calcdmn
  calcdmn.cc
)

target_link_libraries(calcdmn
  PRIVATE
    Szarp2
)

add_executable(dbdmn
  dbdmn.cc
)

target_link_libraries(dbdmn
  PRIVATE
    Szarp2
)

add_executable(ddedmn
  ddedmn.cc
)

target_link_libraries(ddedmn
  PRIVATE
    Szarp2
	${XMLRPCEPI_LIBRARIES}
)

add_executable(dpafdmn
  dpafdmn.cc
)

target_link_libraries(dpafdmn
  PRIVATE
    Szarp2
)

add_executable(dprdmn
  dprdmn.cc
)

target_link_libraries(dprdmn
  PRIVATE
    Szarp2
)

add_executable(execdmn
  execdmn.cc
)

target_link_libraries(execdmn
  PRIVATE
    Szarp2
)

add_executable(ipcinfo
  ipcinfo.cc
)

target_link_libraries(ipcinfo
  PRIVATE
    Szarp2
)

add_executable(k601dmn
  k601dmn.cc cfgdealer_handler.cpp
  k601-prop-plugin.h
)

target_link_libraries(k601dmn
  PRIVATE
    Szarp2
    ${PAM_LIBRARIES}
)

add_executable(kamsdmn
  kamsdmn.cc cfgdealer_handler.cpp
)

target_link_libraries(kamsdmn
  PRIVATE
    Szarp2
)

add_executable(mbdmn
  mbdmn.cc
)

target_link_libraries(mbdmn
  PRIVATE
    Szarp2
)

add_executable(borutadmn
  borutadmn.cc boruta_zet.cc boruta_modbus.cc boruta_fp210.cc
  boruta_wmtp.cc boruta_lumel.cc boruta_fc.cc cfgdealer_handler.cpp
  borutadmn.h borutadmn_z.h
)

target_link_libraries(borutadmn
  PRIVATE
    Szarp2
)

add_executable(borutadmn_z
  borutadmn_z.cc boruta_modbus_z.cc boruta_fc_z.cc cfgdealer_handler.cpp
)

target_link_libraries(borutadmn_z
  PRIVATE
    Szarp2
)

add_executable(mbrtudmn
  mbrtudmn.cc
)

target_link_libraries(mbrtudmn
  PRIVATE
    Szarp2
)

add_executable(mbusdmn
  mbusdmn.cc
)

target_link_libraries(mbusdmn
  PRIVATE
    Szarp2
)

add_executable(nrsdmn
  nrsdmn.cc
)

target_link_libraries(nrsdmn
  PRIVATE
    Szarp2
)

add_executable(pafdmn
  pafdmn.cc
)

target_link_libraries(pafdmn
  PRIVATE
    Szarp2
)

add_executable(pafdmnr
  pafdmnr.cc
)

target_link_libraries(pafdmnr
  PRIVATE
    Szarp2
)

add_executable(parcook
  parcook.cc funtable.cc
  funtable.h
)

target_link_libraries(parcook
  PRIVATE
    Szarp2
)

add_executable(polludmn
  polludmn.cc
)

target_include_directories(polludmn
  PUBLIC
    ${CMAKE_SOURCE_DIR}/libSzarp/include
    ${CMAKE_SOURCE_DIR}/libSzarp2/include
    ${LIBXML2_INCLUDE_DIR}
    ${LUA_INCLUDE_DIR}
)

target_link_libraries(polludmn
  PRIVATE
    Szarp2
)

add_executable(ratedmn
  ratedmn.cc
)

target_link_libraries(ratedmn
  PRIVATE
    Szarp2
)

add_executable(rsdmn
  nrsdmn.cc
)

target_link_libraries(rsdmn
  PRIVATE
    Szarp2
)

add_executable(sampledmn
  sampledmn.cc base_daemon.cc
)

target_link_libraries(sampledmn
  PRIVATE
    Szarp2
)

add_executable(sbusdmn
  sbusdmn.cc cfgdealer_handler.cpp
)

target_link_libraries(sbusdmn
  PRIVATE
    Szarp2
)

add_executable(iecdmn
  iecdmn.cc
)
target_link_libraries(iecdmn
  PRIVATE
    Szarp2
)

add_executable(prodmn
  prodmn.cc
)

target_link_libraries(prodmn
  PRIVATE
    Szarp2
)

add_executable(tcpdmn
  tcpdmn.cc
)

target_link_libraries(tcpdmn
  PRIVATE
    Szarp2
)

add_executable(testdmn
  testdmn.cc
)

target_link_libraries(testdmn
  PRIVATE
    Szarp2
)

add_executable(wlkdmn
  wlkdmn.cc
)

target_link_libraries(wlkdmn
  PRIVATE
    Szarp2
)

add_executable(kwmsdmn
  kwmsdmn.cc
)

target_link_libraries(kwmsdmn
  PRIVATE
    Szarp2
)

add_executable(lbdmn
  lbdmn.cc
)

target_link_libraries(lbdmn
  PRIVATE
    Szarp2
)

add_executable(snap7dmn
  snap7dmn.cc base_daemon.cc
)

target_link_libraries(snap7dmn
  PRIVATE
    Szarp2
    ${SNAP_LIBRARIES}
)

add_executable(pythondmn
  pythondmn.cc cfgdealer_handler.cpp
)

target_include_directories(pythondmn
  PRIVATE
    ${PYTHON_INCLUDE_DIRS}
)

target_link_libraries(pythondmn
  PRIVATE
    Szarp2
    ${PYTHON_LIBRARIES}
)

add_executable(defdmn
  defdmn.cc funtable.cc
  defdmn.h defdmn.tpp funtable.h
)

target_link_libraries(defdmn
  PRIVATE
    Szarp2
)

install(TARGETS aqtdmn calcdmn dbdmn ddedmn dpafdmn dprdmn execdmn ipcinfo
	k601dmn kamsdmn kwmsdmn mbdmn borutadmn borutadmn_z lbdmn mbrtudmn mbusdmn nrsdmn pafdmn
	pafdmnr parcook polludmn ratedmn rsdmn sampledmn snap7dmn sbusdmn iecdmn prodmn tcpdmn
	testdmn wlkdmn pythondmn defdmn
	RUNTIME DESTINATION "${INSTALL_BINDIR}" DESTINATION bin)
